home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 75 / XENIATGM75.iso / Shareware / X-Setup 5.0 / _SETUP.1 / XQ CD AutoStart Options 2.xpl < prev    next >
Text File  |  1999-06-14  |  4KB  |  131 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 5.0"
  2. "TYPE"="6"
  3. "COUNT"="4"
  4. "UIPATH"="System\File System\CD Autostart"
  5. "NAME"="Autostart Data CD"
  6. "VERSION"="Version 1.52"
  7. "LANGUAGE"="VBScript"
  8. "TEXT 1"="Allow autostart for CD-ROMs (normal)"
  9. "TEXT 2"="Allow autostart for removable drives (diskettes, ZIP)"
  10. "TEXT 3"="Allow autostart for fixed drives (HD)"
  11. "TEXT 4"="Allow autostart for network drives"
  12. "DESCRIPTION 1"="If you normally insert a CD in your CD-ROM-drive, Windows starts a program using the file AUTOSTART.INF."
  13. "DESCRIPTION 2"="If you do not like this behavior, or want to enable this behavior for other drives also, you can do it here."
  14. "DESCRIPTION 3"="IMPORTANT: If you activate AutoRun for removable devices or network drives, Windows will check these drives every time you open the explorer or a file requester in an application. Because this check takes some time, this behavior can be really annoying. Please keep this in mind."
  15. "AUTHOR"="Xteq Systems"
  16. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  17. "COMMENT 1"="For more information, go to http://www.xteq.com or write to TeXHeX@xteq.com"
  18. "COMMENT 2"=" "
  19. "COMMENT 3"="This was a hell lot of work!" 
  20. "COMMENT 4"="Special thanks to Tony Caine (72614.1451@compuserve.com) who has helped us a lot with this plug-in. Also thanks to Guy (dr_teeth@bigfoot.com)."
  21.  
  22.  
  23. 'What about this key?
  24. 'HKLM\System\CurrentControlSet\Services\Cdrom\Autorun
  25.  
  26. 'Declaration of some constants
  27. DRIVE_UNKNOWN=1   'Bit 0
  28. DRIVE_NO_ROOT=2   'Bit 1
  29. DRIVE_REMOVABLE=4 'Bit 2 
  30. DRIVE_FIXED=8     'Bit 3 
  31. DRIVE_REMOTE=16   'Bit 4 
  32. DRIVE_CDROM=32    'Bit 5 
  33. DRIVE_RAMDISK=64  'Bit 6 
  34. DRIVE_FUTURE=128  'Bit 7 
  35.  
  36. sPathValue="HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutoRun"
  37.  
  38. 'Called when the Plugin is started
  39. SUB Plugin_Initialize
  40.  s=RegReadValue(sPathValue)
  41.  
  42.  dim i
  43.  if len(s)>1 then
  44.     s=left(s,2)
  45.     i=s
  46.  else
  47.     i=CInt(0)
  48.  end if
  49.  
  50.  '//Convert the value to INT
  51.  s="&H" & i
  52.  i=CInt(s)
  53.  
  54.  
  55.  'TH: Looks stupid, I know! but there is no way to get OR working with variants!
  56.  'AK: JScript ||. Should work
  57.  
  58.  dim b1,b2,b3,b4,b5,b6,b7
  59.  i=OrHelper(i,DRIVE_FUTURE,b1)
  60.  i=OrHelper(i,DRIVE_RAMDISK,b2) 
  61.  i=OrHelper(i,DRIVE_CDROM,b3)
  62.  i=OrHelper(i,DRIVE_REMOTE,b4)
  63.  i=OrHelper(i,DRIVE_FIXED,b5)
  64.  i=OrHelper(i,DRIVE_REMOVABLE,b6)
  65.  i=OrHelper(i,DRIVE_NO_ROOT,b7)
  66.  
  67.  
  68.  '//If the bit is set, AutoRun is DISABLED
  69.  Call SetBox(b3,1)
  70.  Call SetBox(b6,2)
  71.  Call SetBox(b5,3)
  72.  Call SetBox(b4,4)
  73. END SUB
  74.  
  75. Function OrHelper(CurValue,CheckVal,CheckValSet)
  76.  i=CurValue
  77.  
  78.  if i>=CheckVal then
  79.     CheckValSet=true
  80.     i=i-CheckVal
  81.  else
  82.     CheckValSet=false
  83.  end if
  84.  
  85.  OrHelper=i
  86. End Function
  87.  
  88. Sub SetBox(CurVal,Elm)
  89.     if CurVal=true then
  90.        SetUIElement elm,false
  91.     else
  92.        SetUIElement elm,true
  93.     end if
  94. End Sub
  95.  
  96.  
  97. 'Called when the Plugin should validate the Data the user has entered
  98. SUB Plugin_CheckData(ElementIndex)
  99. END SUB
  100.  
  101. 'Called when the Plugin should apply the changes
  102. SUB Plugin_Apply(ElementIndex,ElementSubIndex)
  103.  i=0
  104.  
  105.  'Always disable autorun for the following drives 
  106.  'according to Q136214 from MS KB
  107.  i=i+DRIVE_UNKNOWN
  108.  i=i+DRIVE_FUTURE
  109.  '//Needed??? i=i+DRIVE_NO_ROOT
  110.  
  111.  
  112.  'No let's see what the user wants
  113.  if GetUIElement(1)=false then i=i+DRIVE_CDROM
  114.  if GetUIElement(2)=false then i=i+DRIVE_REMOVABLE
  115.  if GetUIElement(3)=false then i=i+DRIVE_FIXED
  116.  if GetUIElement(4)=false then i=i+DRIVE_REMOTE
  117.  
  118.  'Convert to HEX so XSET can write the value
  119.  Dim v
  120.  v=Hex(i) 
  121.  v=v & "000000"
  122.  
  123.  
  124.  Call RegWriteValue(sPathValue,v,3)
  125.  Call Restart
  126. END SUB
  127.  
  128. 'Called when the Plugin is about to be removed from memory
  129. SUB Plugin_Terminate
  130. END SUB
  131.